package com.hehan.hhdemo.controller;

import com.alibaba.fastjson.JSON;
import com.hehan.hhdemo.vo.LoginParamVO;
import com.hehan.hhdemo.vo.LoginResutVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author cjbi
 */
@Controller
public class LoginController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @PostMapping("/login")
    @ResponseBody
    public LoginResutVO login(@RequestBody LoginParamVO paramVO) {
        logger.info(JSON.toJSONString(paramVO));
        return new LoginResutVO("super_admin");
    }

    @GetMapping("/get_info")
    public ResponseEntity getUserInfo(String token) {
        logger.info(token);
        return ResponseEntity.ok("{     name: 'super_admin',     user_id: '1',     access: ['super_admin', 'admin'],     token: 'super_admin',     avator: 'https://file.iviewui.com/dist/a0e88e83800f138b94d2414621bd9704.png'   }");
    }

}
